import * as THREE from 'three'
export class Fire {
    constructor(scene, center, size) {
        this.scene = scene
        this.center = center // 建筑物中心点
        this.size = size // 建筑物大小
        this.init()
    }

    init () {
        const loader = new THREE.TextureLoader()
        const fire = loader.load('icon/fire.png')
        // 创建精灵材质
        const SpriteMaterial = new THREE.SpriteMaterial({
            map: fire,
        })
        // 创建精灵物体
        const sprite = new THREE.Sprite(SpriteMaterial)
        sprite.position.set(this.center.x, this.center.y + this.size.y / 2 + 3, this.center.z)
        sprite.scale.set(10, 10, 10)
        this.scene.add(sprite)
        this.model = sprite
    }

    clear () {
        console.log('清除了fire');
        this.scene.remove(this.model)
    }
  
}
